class EndLessWinListUI extends UIBase{
    private btn_sure:BaseButton;
    private item_1:EndLessWinItem;
    private item_2:EndLessWinItem;
    private item_3:EndLessWinItem;

    private nameScroller:eui.Scroller;
    private nameList:eui.List;
    private endLessInfo;
    constructor()
    {
        super('EndLessWinListView',{showBG:true});
    }

    public init()
    {
        super.init(true);
        this.requestInfo();
    }

    public requestInfo()
    {
        let sendParma = {
            version:GameConst.version
        }
        HttpManager.instance().sendPost(GameConst.httpUrl + 'warriorendless/get_week_lucky', StringUtil.jsonToHttpPostString(sendParma), (e)=>{
            let data = JSON.parse(e);
            if(data && data.data)
            {
                this.endLessInfo = data.data;
                this.initUI();
            }
        }, this);
    }

    public initUI()
    {
        if(this.endLessInfo)
        {
            let _listArr = new eui.ArrayCollection(this.endLessInfo);
            this.nameList.dataProvider = _listArr;
            this.nameList.itemRenderer = EndLessWinItem;
        }
    }

    public addEvent()
    {
        this.btn_sure.addTapHandler(this.close, this);
    }

    public close()
    {
        this.remove(1);
    }

    public removeEvent()
    {
        this.btn_sure.removeTapHandler();
    }

    public clear()
    {
        super.clear();
        this.endLessInfo = null;
        this.nameList.dataProvider = null;
        this.nameList.itemRenderer = null;
    }
}